package cn.itcast.java.bufferedstream;


import java.io.BufferedInputStream;
import java.io.FileInputStream;
import java.io.IOException;

/**
 * Author itcast
 * Date 2021/10/13 17:04
 * Desc TODO
 */
public class BufferedInputStreamDemo {
    public static void main(String[] args) throws IOException {
        //读取 input.dat 文件
        //生成 FileInputStream
        FileInputStream fis = new FileInputStream("data/input.dat");
        //实例化一个 BufferedInputStream
        BufferedInputStream bufferedInputStream = new BufferedInputStream(fis);
        //读取数据
        byte[] bts = new byte[3];
        int len = 0;
        while((len = bufferedInputStream.read(bts))!=-1){
            System.out.print(new String(bts,0,len));
        }
        //打印输出
    }
}
